// 提交信息
var fieldSet = new Ext.form.FieldSet({
	layout:'form',
	autoHeight:true,
	autoWidth:true,
	title:'基本信息保存',
	buttonAlign: 'center',
	items:[{  
    				xtype:'hidden',
    				name:'id',
    				value:0
			   },{  
    				xtype:'textfield',
    				name:'name',
    				fieldLabel:'名称'
			   }
	],
	buttons: [{
        text: '保存',
        iconCls:'add', 
        handler: function(){
			 if(formPanel.getForm().isValid()){
			 	var basicForm = formPanel.getForm();
			 	var formObj = basicForm.getValues(false);
				basicForm.submit({
					url: '../../addOrUpd.do',
					waitMsg: '正在保存...',
					success: function(formP, o){
						var msg = "保存成功!"
						if(o.result.success){
							if(null != o.result.wornmsg){
								msg +=  o.result.wornmsg;
							   }
							 Ext.Msg.show({
								title: "消息",
								msg: msg,
								minWidth: 200,
								modal: true,
								icon: Ext.Msg.INFO,
								buttons: Ext.Msg.OK,
								fn:function(btn){
									formPanel.getForm().reset();
									var valObj = schForm.getForm().getValues();
									grid.store.baseParams = valObj;
									grid.store.load({params:{start:0,limit:10}});
									inputWin.hide();
								}
							});
						}else{
							msg("消息","无法导入文件,请检查文件内容或书写格式是否正确!");
						}
					}
				});
			}
		
        }
    },{
        text: '重置',
        iconCls:'delete',
        handler: function(){
    		formPanel.getForm().reset();
        }
    },{
        text: '取消',
        iconCls:'cross',
        handler: function(){
    		formPanel.getForm().reset();
    		inputWin.hide();
        }
    }]
});

//提交框
var formPanel = new Ext.FormPanel({
	 method:'post',
	 frame: true,
     defaults: {
		allowBlank: false,
		msgTarget: 'side'
	 },
	items: [fieldSet]
});
//弹出框
var inputWin = new Ext.Window({
	title:'保存',
	frame:true,
	autoHeight:true,
	width:'25%',
	//与背景色一致
	plain:true,
	modal:true,
	resizable : false,
	closable : true,
	closeAction : 'hide',
	items : [formPanel],
	listeners :{
		  hide:function(){
			formPanel.getForm().reset();
		  }
	 }
});

function showInputWin(){
	var el = this.getPositionEl();
	inputWin.setPosition(el.getLeft(),el.getRight());
	inputWin.setTitle("保存");
	inputWin.show();
}